package com.media_server.properties;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;

import java.util.Map;

/**
 * Minio配置读取
 */
@ConfigurationProperties(prefix = "minio")
@EnableConfigurationProperties(MinioProperties.class)
@Data
@Slf4j
public class MinioProperties implements InitializingBean {
    private String host;  // 指定minio服务器地址
    private String accessKey;  // 指定用户名
    private String secretKey; // 密码
    private Map<String,String> bucket; // 存储桶
    private String defaultBucket; // 默认存储桶
    private Long maxFileSize = 500L; // 单个文件最大限制 单位MB

    @Override
    public void afterPropertiesSet() throws Exception {
        log.debug("Properties 'MinioProperties' configured for use");
        this.host = "http://" + this.host + "/";
    }
}
